﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GenericLibrariesToolKit
{
    /// <summary>
    /// 通用工具类
    /// </summary>
    public class GenericUtils
    {
        /// <summary>
        /// 通过反射,获得指定类的父类的泛型参数的实际类型.
        /// </summary>
        /// <param name="inputType"></param>
        /// <returns></returns>
        public static Type GetSuperClassGenricType(Type inputType)
        {
            Type[] types = new Type[] { };

            //获取指定类父类的泛型参数的实际类型的数组
            types = inputType.BaseType.GetGenericArguments();

            return types[0];
        }

    }
}
